<?php
/**
 * Created by PhpStorm.
 * User: zouyanan
 * Date: 2019/5/11
 * Time: 下午10:35
 */

namespace app\api\controller;


use app\common\controller\Api;

class House extends Api
{
    protected $noNeedLogin = ['silenceLogin', 'login', 'test', 'smsCode', 'checkCode','userauthType'];
    protected $noNeedRight = '*';


    public function landlordAdd(){
        $userInfo = $this->auth->getUserinfo();
        $name = $this->request->request('name');
        $idcard = $this->request->request('idcard');
        $gender = $this->request->request('gender');
        $age = $this->request->request('age');
        $mobile = $this->request->request('mobile');
        $wx = $this->request->request('wx');
        $qq = $this->request->request('qq');
        $remark = $this->request->request('remark');
        if(!$name || !$idcard || !$gender || !$age || !$mobile || !$wx || !$qq || !$remark){
            $this->error('缺少参数');
        }
        $res = db('user')->insert([
            'name'  =>  $name,
            'idcard'=>  $idcard,
            'gender'=>  $gender,
            'age'   =>  $age,
            'mobile'=>  $mobile,
            'wx'    =>  $wx,
            'qq'    =>  $qq,
            'remark'=>  $remark,
            'agent_id' => $userInfo['id'],
            'createtime'=>time()
        ]);
        if($res){
            $this->success('信息添加成功');
        }else{
            $this->error('信息添加失败');
        }
    }


    public function renterAdd(){
        $userInfo = $this->auth->getUserinfo();
        $name = $this->request->request('name');
        $idcard = $this->request->request('idcard');
        $gender = $this->request->request('gender');
        $age = $this->request->request('age');
        $mobile = $this->request->request('mobile');
        $wx = $this->request->request('wx');
        $qq = $this->request->request('qq');
        $remark = $this->request->request('remark');
        if(!$name || !$idcard || !$gender || !$age || !$mobile || !$wx || !$qq || !$remark){
            $this->error('缺少参数');
        }
        $res = db('user')->insert([
            'name'  =>  $name,
            'idcard'=>  $idcard,
            'gender'=>  $gender,
            'age'   =>  $age,
            'mobile'=>  $mobile,
            'wx'    =>  $wx,
            'qq'    =>  $qq,
            'remark'=>  $remark,
            'agent_id' => $userInfo['id'],
            'createtime'=>time()
        ]);
        if($res){
            $this->success('信息添加成功');
        }else{
            $this->error('信息添加失败');
        }















    }



















}